import request from '@/utils/request'

export function login(data) {
    return request({
        url: '/user/login',
        method: 'post',
        data
    })
}

export function getInfo(token) {
    return request({
        url: '/user/getInfo',
        method: 'post',
        params: { token },
    })
}

export function logout(token) {
    return request({
        url: '/user/logout',
        method: 'post',
        params: { token }
    })
}

export function getList(query) {
    return request({
        url: '/user/user',
        method: 'get',
        params: { query }
    })
}


export function updateUser(data) {
    console.log('更新', data)
    if (data.role) delete data.role
    return request({
        url: '/user/user',
        method: 'put',
        data
    })
}


export function register(data) {
    if (data.role) delete data.role
    return request({
        url: '/user/register',
        method: 'post',
        data
    })
}
